I encountered this bizarre inconsistency issue that Maple18 generates different outputs when executing the same command:
test_res2:= factor( simplify( expand( value( subs( Perturbation_Sol, EQ_PX2_order_7 ) ) ) ) )
'EQ_PX2_order_7' is a rational expression in sin(i0), cos(i0), sin(uL), and cos(uL) with rational coefficient terms. It also has inert differentiation terms Diff( * , uL ).
'Perturbation_Sol' is a set of 171 elements in the form of 'parameter_name = expression'.
My goal is to check if substituting 'Perturbation_Sol' into 'EQ_PX2_order_7' yields 0. Since 'EQ_PX2_order_7' has inert differentiation terms, I've applied 'value' after using 'subs'. Then I apply 'expand', 'simplify', and 'factor' to reduce the result to the simplest form.
However, Maple18 generates different outputs when I just execute this repeatedly. Please see the worksheet "test.mw" for details. Any insight will be greatly appreciated! Also, I wonder if the same issue would happen when the worksheet is executed with newer versions of Maple.
EQN_SOL_test1.mla
test.mw
I encountered the problem with .m files originally. But MaplePrimes doesn't allow uploading .m files, so I had to save the expressions into the file "EQN_SOL_test1.mla", which is included in this question. Below we load the expressions from the .mla file first, and then save them into a .m file in order to recreate the problem that I encountered.
> |
read "EQN_SOL_test1.mla":
# Load 'EQ_PX2_order_7' and 'Perturbation_Sol'
|
> |
save
EQ_PX2_order_7,
Perturbation_Sol,
"EQN_SOL_test1_m.m";
# Save the expressions into a .m file
|
Now we demonstrate the inconsistency problem with .m files. Notice that Maple generates 3 possible outputs:



The last 2 outputs cannot be reduced to 0 since is nonzero as shown below.
> |
plot3d( 5*cos(i0)^2*cos(uL)^2-7*cos(i0)^2-5*cos(uL)^2+4 , uL=0..2*Pi, i0=0..2*Pi );
|
> |
read "EQN_SOL_test1_m.m":
|
> |
length( EQ_PX2_order_7 );
|

|
(1) |
> |
length( Perturbation_Sol );
|

|
(2) |
> |
numelems( Perturbation_Sol );
|

|
(3) |
> |
Perturbation_Sol[1..5];
# Just to give an example of what the elements in 'Perturbation_Sol' look like
|
![{PX1[1] = 0, PX1[2] = 0, PX1[3] = -(1/4)*rho0*a0*Be, PX1[4] = (1/2)*rho0*a0*Be*WEra*cos(i0)-(3/16)*R_earth^2*a0*rho0*(3*cos(i0)^2-1)*J2re*Be/sha+(1/4)*Be*a0*rho0*X10[3]/sha, PX1[5] = (1/4)*rho0*a0*X10[4]*Be/sha-(1/256)*R_earth^4*a0*rho0*(163*cos(i0)^4-110*cos(i0)^2+19)*J2re^2*Be/sha^2+(3/16)*R_earth^2*a0*rho0*(3*cos(i0)^2-1)*J2re*Be*X10[3]/sha^2+(3/8)*cos(i0)*R_earth^2*WEra*a0*rho0*(3*cos(i0)^2-1)*J2re*Be/sha-(1/48)*Be^3*a0^3*rho0^3*s1/sha^2-(1/8)*Be*a0*rho0*X10[3]^2/sha^2-(1/2)*cos(i0)*WEra*a0*rho0*Be*X10[3]/sha-(1/16)*rho0*a0*(3*cos(i0)^2+1)*Be*WEra^2-(1/32)*Be^2*J2re*R_earth^2*a0^2*rho0^2*sin(i0)^2*sin(2*uL)/sha^2}](/view.aspx?sf=240144_question/8ee07b64e4a0d4a24adfcbdb6fee8d64.gif)
|
(4) |
> |
for j from 1 to 50 do
test_res2:= factor( simplify( expand( value( subs( Perturbation_Sol, EQ_PX2_order_7 ) ) ) ) );
end do;
|

|
(5) |
It seems that with .mla files the problem occurs in a different way! With "EQN_SOL_test1.mla", the outputs for all 50 iterations stay the same as
(A)
but they may all change to the following different result after retarting many times:
(B)
In particular, after a large number of test runs (i.e., open the file "test.mw", execute the worksheet, close the file, and repeat), the result (B) has only occured twice. The second appearance is saved here for you to view. Once you re-execute this worksheet, most likely all outputs below will change back to (A), and (B) will only reappear after a large number of reruns.
> |
read "EQN_SOL_test1.mla":
# Load 'EQ_PX2_order_7' and 'Perturbation_Sol'
|
> |
for j from 1 to 50 do
test_res2:= factor( simplify( expand( value( subs( Perturbation_Sol, EQ_PX2_order_7 ) ) ) ) );
end do;
|

|
(6) |
|
Download test.mw